import { Position, Range, TextDocument } from "vscode";

export function insideShell(document: TextDocument, position: Position): boolean {
    var reg = /#(?:run|script|system)/i;
    if (!reg.test(document.getText())) {
        console.log("无匹配的shell脚本")
        return false;
    }


    return true;
}

export function getShellContent(document: TextDocument, position: Position): string {
    var pos = new Position(position.line - 1, 0);
    var ep = new Position(position.line, position.character + 1)
    return document.getText(new Range(pos, ep));
}
